package com.supermarket.seefood51.login.presenter

import android.content.Context
import com.supermarket.seefood51.base.BaseModel
import com.supermarket.seefood51.entity.UserEntity
import com.supermarket.seefood51.linstener.OnLoadRequestListener
import com.supermarket.seefood51.login.model.LoginModel
import com.supermarket.seefood51.login.model.LoginModelImpl
import com.supermarket.seefood51.login.view.LoginView

class LoginPresenterImpl(private var mContext: Context,
                         private var mLoginView: LoginView) :LoginPresenter,OnLoadRequestListener<UserEntity>{

    private var mLoginModel : LoginModel = LoginModelImpl()

    override fun login(name: String, pwd: String,deviceId:String) {
        mLoginModel.login(mContext,name,pwd,deviceId,this)
    }

    override fun onSuccess(t: UserEntity?) {

        mLoginView.saveUserInfo(t!!)
    }

    override fun onFail(e: Throwable?) {

    }

}